package com.neuedu.hisboot.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neuedu.hisboot.entity.PatientInfo;
import com.neuedu.hisboot.mapper.PatientInfoMapper;
import com.neuedu.hisboot.service.IPatientInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 病人详细信息管理服务实现类
 * </p>
 *
 * @author jaun
 * @since 2025-07-04
 */
@Service
public class PatientInfoServiceImpl extends ServiceImpl<PatientInfoMapper, PatientInfo> implements IPatientInfoService {

    @Override
    public PatientInfo getByMrid(String mrid) {
        QueryWrapper<PatientInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("mrid", mrid);
        queryWrapper.eq("delMark", 1);
        return this.getOne(queryWrapper);
    }

    @Override
    public PatientInfo getByIdCard(String idCardNo) {
        QueryWrapper<PatientInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("idCardNo", idCardNo);
        queryWrapper.eq("delMark", 1);
        return this.getOne(queryWrapper);
    }

    @Override
    public PatientInfo getByHospitalizationNumber(String hospitalizationNumber) {
        QueryWrapper<PatientInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("hospitalizationNumber", hospitalizationNumber);
        queryWrapper.eq("delMark", 1);
        return this.getOne(queryWrapper);
    }

    @Override
    public List<PatientInfo> getByDepartment(String departmentName) {
        QueryWrapper<PatientInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("departmentName", departmentName);
        queryWrapper.eq("delMark", 1);
        return this.list(queryWrapper);
    }

    @Override
    public List<PatientInfo> getByDoctor(String doctorName) {
        QueryWrapper<PatientInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("doctorName", doctorName);
        queryWrapper.eq("delMark", 1);
        return this.list(queryWrapper);
    }

    @Override
    public List<PatientInfo> getByIllness(String illness) {
        QueryWrapper<PatientInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("illness", illness);
        queryWrapper.eq("delMark", 1);
        return this.list(queryWrapper);
    }

    @Override
    public List<PatientInfo> getByInsuranceType(String insuranceType) {
        QueryWrapper<PatientInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("medInsuranceType", insuranceType);
        queryWrapper.eq("delMark", 1);
        return this.list(queryWrapper);
    }
}

